# 存放元素
import allure
from selenium.webdriver.common.by import By
from base.base_page import Basspage
# yesmro商城前端
from utils.assert_util import assert_compare


# 搜索SKU、加入购物车、提交订单、取消订单
class ShopPing(Basspage):
    """搜索框元素"""
    # 光标定位搜索框
    Location_search = (By.XPATH, '//*[@id="searchInput"]')
    # 点击搜索按钮有视频
    log_out = (By.XPATH, '//*[@id="header"]/div[4]/div[1]/div[1]/div/div/div/div[3]/div[1]/span')
    # 无视频，点击搜索，这2个元素是不一样的
    log_out2 = (By.XPATH, '//*[@id="header"]/div[3]/div[1]/div[1]/div/div/div/div[3]/div[1]/span')

    """商品详情页元素"""
    # +号数量
    my_amount = (By.XPATH,
                 '//*[@id="__layout"]/div/div[2]/div[2]/div[3]/div[2]/div[2]/div[1]/div[1]/div[2]/div/div/div/div[1]/div[5]/div/div[1]/div/div/div[2]/div[1]/div[2]')
    # 商品详情中，光标定位到数量
    my_quantity = (By.XPATH,
                   '//*[@id="__layout"]/div/div[2]/div[2]/div[3]/div[1]/div/div[2]/div[1]/div[2]/div/div[1]/div[1]/div/div[1]/div/input')
    # 点击加入购物车按钮
    my_join_shopping = (By.XPATH,
                        '//span[contains(text(),"加入购物车")]')
    # 订单详情-立即购买元素
    my_payment = (By.XPATH,
                  '//*[@id="__layout"]/div/div[2]/div[2]/div[3]/div[2]/div[2]/div[1]/div[1]/div[2]/div/div/div/div[1]/div[5]/div/div[1]/div/div/div[4]/span')

    """我的购物车"""
    # 点击我的购物车
    my_click_my_join_shopping = (
        By.XPATH, '//a[contains(text(),"我的购物车")]')
    # 购物车点击全选
    my_shopping_check_all = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[3]/div[1]/div/div/div[1]/label/span/input')
    # 购物车点击删除选中商品
    my_shopping_delete = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[3]/div[1]/div/div/div[1]/a[1]')
    # 购物车明细行点击删除
    shopping_delete = (By.XPATH, '//*[@id="shopping_cart_2099335"]/div/div/div/div[7]/div/div[2]/div[1]/div/a')
    # 购物车点击去结算
    my_shopping_accounts = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[3]/div[1]/div/div/div[2]/a[2]')
    # 购物车定第一行SKU的元素
    my_shopping_SKU = (
    By.XPATH, '/html/body/div[1]/div/div/div[2]/div[2]/div[3]/div/div/div[1]/div/div/div/div[1]/div[3]/div[1]/p/span[1]')
    # 定位购物车删除元素只有2个
    my_SKU_delete = (By.XPATH, '//a[text() = "删除"]')

    """订单确认页面元素"""
    # 订单确认页面-点击支付宝
    my_Alipay = (By.XPATH, '//*[@id="paymentMethodObj"]/div[2]/div[2]/label')
    # 订单确认页面-输入备注
    my_remark = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[1]/div[1]/div[6]/div[2]/div[2]/div/textarea')
    # 订单确认页面-提交订单
    my_submit_order = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[1]/div[2]/div[1]/div/div/div[2]/a')
    # 不开发票
    my_order_invoice = (By.XPATH, '//*[@id="invoiceObj"]/div[2]/div[2]/span')

    """支付页面元素、取消订单元素"""
    # 支付页面-点击订单详情
    my_pay_order = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[2]/div[1]/div[2]/a[1]')
    # 支付页面，获取订单已提交，请及时支付的元素，用过断言
    my_in_alipay = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[2]/div[1]/div[1]/div[2]/span')
    # 订单支付页面-订单号元素
    my_order_number = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[2]/div[3]/span[2]')

    """我的订单页面元素"""
    # 点击企业订单
    my_order = (By.XPATH, '//*[@id="header"]/div[2]/div[1]/div/div[1]/div[2]/a[2]')
    # 搜索输入订单号,项目编号,订货号,型号,物料号,商品名称,品牌
    my_search_order = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[2]/div[2]/div[3]/div[1]/div[1]/div[1]/div/input')
    # 点击搜索按钮
    my_search_button = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[2]/div[2]/div[3]/div[2]/div[1]/label')
    # 点击取消订单
    my_of_order = (
    By.XPATH, '//*[@id="__layout"]/div/div[2]/div[2]/div[2]/div[3]/div[4]/div[2]/div[1]/div[7]/div[5]/span')
    # 取消订单弹窗
    my_pop_order = (By.XPATH, '//*[@id="__layout"]/div/div[2]/div[2]/div[2]/div[8]/div[1]/div/div/div/div')
    # 取消订单-点击其它
    my_of_order_other = (By.XPATH,
                         '//*[@id="__layout"]/div/div[2]/div[2]/div[2]/div[8]/div[1]/div/div/div/div/div[2]/div/form/div[4]/div[2]/div/label')
    # 点击立即取消
    my_immediate_cancel = (
    By.XPATH, '//*[@id="__layout"]/div/div[2]/div[2]/div[2]/div[8]/div[1]/div/div/div/div/div[3]/a[2]')
    # 取消成功元素
    my_Cancel_successfully = (By.XPATH, '//span[contains(text(),"已取消")]')
